package com.android.LFRFID;

import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

import android.util.Log;

public class SerialPort {
	
	public FileDescriptor mFd;
	public FileInputStream mFileInputStream;
	public FileOutputStream mFileOutputStream;
	
	public void Open(){

		mFd = open();
		if (mFd == null) {	
			return;
		}
	
		mFileInputStream = new FileInputStream(mFd);
		mFileOutputStream = new FileOutputStream(mFd);
		
	}
	
	public InputStream getInputStream() {
		return mFileInputStream;
	}

	public OutputStream getOutputStream() {
		return mFileOutputStream;
	}
	
	private native  FileDescriptor open();
	public native void close();
    
	static {
		System.loadLibrary("LFRfid");
	}	
}
